import * as tslib_1 from "tslib";
import { observable, action } from "mobx";
import * as api from "../api/api";
import request from "../utils/request";
import { LoadHoc, loading } from "../hoc/loadHoc";
let UserStore = class UserStore extends LoadHoc {
  constructor() {
    super(...arguments);
    /**
     * 获取验证码
     */
    this.smsCode = '';
    /**
     * 注册第一步-输入手机号获取验证码
     */
    this.registerStepOne = {};
    /**
     * 获取用户信息
     * 该接口返回的token为空
     */
    this.userInfo = {};
    /**
     * 获取用户佣金
     */
    this.userCommisions = {};
    /**
     * 获取提现明细
     */
    this.userCashes = {};
    /**
     * 获取推广用户
     */
    this.spreadUsers = {};
    /**
     * 获取推广用户数量
     */
    this.userShareCount = {};
    /**
     * 获取推广用户下级成员
     */
    this.userShareUsers = {};
    /**
     * 获取用户收藏列表
     */
    this.userFavorites = {};
    /**
     * 获取用户银行卡
     */
    this.userCards = {};
    /**
     * 获取平台支持的银行卡
     */
    this.banks = {};
    /**
     * 获取用户收货地址
     */
    this.userAddresses = {};
    /**
     * 获取用户积分
     */
    this.userPointRecords = {};
    /**
     * 我的发布
     */
    this.myRelease = {};
    /**
     * 我的申请
     */
    this.myApplication = {};
    /**
     * 我的课程
     */
    this.myCourseInfo = {};
    /**
     * 问答
     */
    this.doubtAnswers = {};
    /**
     * 问答详情
     */
    this.doubtAnswer = {};
    /**
     * 查询代理升级费用
     */
    this.agencyAmount = {};
    /**
     * 查询代理升级购买记录
     */
    this.userBuyAgencyLeval = {};
    /**
     * 用户注册协议
     */
    this.userRegistAgreement = {};
    /**
     * 用户参与的公益众筹项目
     */
    this.allUserCrowdFunding = {};
  }
  async getSmsCode(params) {
    const { form, callback } = params;
    const smsCode = await request(api.AppuserApiFetchParamCreactor.appuserSendCodeAsync({
      form
    }));
    this.smsCode = smsCode;
    callback && callback(smsCode);
  }
  /**
   * 用户登录
   */
  async userLogin(params) {
    const { form, callback } = params;
    const userLoginRes = await request(api.AppuserApiFetchParamCreactor.appuserLoginAsync({
      form
    }));
    callback && callback(userLoginRes);
  }
  /**
   * 注册第一步
   */
  async registerStepOneF(params) {
    const { form, callback } = params;
    const registerStepOne = await request(api.AppuserApiFetchParamCreactor.appuserRegisterAsync({
      form
    }));
    this.registerStepOne = registerStepOne;
    callback && callback(registerStepOne);
  }
  /**
   * 用户登出
   */
  async logout(params) {
    const { callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserLogoutAsync({}));
    callback && callback(res);
  }
  async getUserInfo(params) {
    const { callback } = params;
    const userInfo = await request(api.AppuserApiFetchParamCreactor.appuserGetUserInfoAsync({}));
    this.userInfo = userInfo;
    callback && callback(userInfo);
  }
  /**
   * 设置密码
   */
  async setPassword(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserSetPasswordAsync({
      form
    }));
    callback && callback(res);
  }
  /**
   * 会员中心修改密码
   */
  async updateUserPassword(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserUpdateUserPasswordAsync({
      form
    }));
    callback && callback(res);
  }
  async getUserCommisions(params) {
    const { pageIndex, pageSize, callback } = params;
    const userCommisions = await request(api.AppuserApiFetchParamCreactor.appuserGetUserCommisionsAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.userCommisions = userCommisions;
    callback && callback(userCommisions);
  }
  async getUserCashes(params) {
    const { pageIndex, pageSize, callback } = params;
    const userCashes = await request(api.AppuserApiFetchParamCreactor.appuserGetUserCashesAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.userCashes = userCashes;
    callback && callback(userCashes);
  }
  /**
   * 获取用户提现手续费率
   */
  async getCashService(params) {
    const { callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserGetCashServiceAsync({}));
    callback && callback(res);
  }
  /**
   * 获取用户收益记录
   */
  async getUserBenifitsStatistics(params) {
    const { callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserGetUserBenifitsStatisticsAsync({}));
    callback && callback(res);
  }
  /**
   * 用户提现
   */
  async cash(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserCashAsync({
      form
    }));
    callback && callback(res);
  }
  async getSpreadUsers(params) {
    const { formLevel, pageIndex, pageSize, callback } = params;
    const spreadUsers = await request(api.AppuserApiFetchParamCreactor.appuserGetSpreadUsersAsync({
      formLevel,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.spreadUsers = spreadUsers;
    callback && callback(spreadUsers);
  }
  async getUserShareCount(params) {
    const { callback } = params;
    const userShareCount = await request(api.AppuserApiFetchParamCreactor.appuserGetUserShareCountAsync({}));
    this.userShareCount = userShareCount;
    callback && callback(userShareCount);
  }
  async getUserShareUsers(params) {
    const { formUserId, formLevel, pageIndex, pageSize, callback } = params;
    const userShareUsers = await request(api.AppuserApiFetchParamCreactor.appuserGetUserShareUsersAsync({
      formUserId,
      formLevel,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.userShareUsers = userShareUsers;
    callback && callback(userShareUsers);
  }
  async getUserFavorites(params) {
    const { pageIndex, pageSize, callback } = params;
    const userFavorites = await request(api.AppuserApiFetchParamCreactor.appuserGetUserFavoritesAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.userFavorites = userFavorites;
    callback && callback(userFavorites);
  }
  async getUserCards(params) {
    const { callback } = params;
    const userCards = await request(api.AppuserApiFetchParamCreactor.appuserGetUserCardsAsync({}));
    this.userCards = userCards;
    callback && callback(userCards);
  }
  async getBanks(params) {
    const { callback } = params;
    const banks = await request(api.AppuserApiFetchParamCreactor.appuserGetBanksAsync({}));
    this.banks = banks;
    callback && callback(banks);
  }
  /**
   * 保存银行卡
   */
  async saveUserCard(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserSaveUserCardAsync({
      form
    }));
    callback && callback(res);
  }
  /**
   *删除用户银行卡
   */
  async removeUserCard(params) {
    const { id, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserRemoveUserCardAsync({
      form: {
        id
      }
    }));
    callback && callback(res);
  }
  /**
   * 修改用户信息
   */
  async modifyUser(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserModifyUserAsync({
      form
    }));
    callback && callback(res);
  }
  async getUserAddresses(params) {
    const { callback } = params;
    const userAddresses = await request(api.AppuserApiFetchParamCreactor.appuserGetUserAddressesAsync({}));
    this.userAddresses = userAddresses;
    callback && callback(userAddresses);
  }
  /**
   *保存用户收货地址
   */
  async saveUserAddress(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserSaveUserAddressAsync({
      form
    }));
    callback && callback(res);
  }
  /**
   * 删除用户收货地址
   */
  async removeUserAddress(params) {
    const { id, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserRemoveUserAddressAsync({
      form: {
        id
      }
    }));
    callback && callback(res);
  }
  /**
   * 设置用户默认收货地址
   */
  async setDefaultUserAddress(params) {
    const { id, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserSetDefaultUserAddressAsync({
      form: {
        id
      }
    }));
    callback && callback(res);
  }
  /**
   * 用户收藏
   */
  async saveUserCollection(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserSaveUserCollectionAsync({
      form
    }), '', false);
    callback && callback(res);
  }
  /**
   * 用户取消收藏
   */
  async cancelUserCollection(params) {
    const { form, callback } = params;
    const res = await request(api.AppuserApiFetchParamCreactor.appuserCancelUserCollectionAsync({
      form
    }), '', false);
    callback && callback(res);
  }
  async getUserPointRecords(params) {
    const { userPointsType, pageIndex, pageSize, callback } = params;
    const userPointRecords = await request(api.AppuserApiFetchParamCreactor.appuserGetUserPointRecordsAsync({
      formUserPointsType: userPointsType,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.userPointRecords = userPointRecords;
    callback && callback(userPointRecords);
  }
  async getMyRelease(params) {
    const { publicationType, pageIndex, pageSize, callback } = params;
    const myRelease = await request(api.AppuserApiFetchParamCreactor.appuserGetMyReleaseAsync({
      formPublicationType: publicationType,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.myRelease = myRelease;
    callback && callback(myRelease);
  }
  async getMyApplication(params) {
    const { pageIndex, pageSize, callback } = params;
    const myApplication = await request(api.AppuserApiFetchParamCreactor.appuserGetMyApplicationAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.myApplication = myApplication;
    callback && callback(myApplication);
  }
  async getMyCourseInfo(params) {
    const { pageIndex, pageSize, callback } = params;
    const myCourseInfo = await request(api.AppuserApiFetchParamCreactor.appuserGetMyCourseInfoAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.myCourseInfo = myCourseInfo;
    callback && callback(myCourseInfo);
  }
  async getDoubtAnswers(params) {
    const { callback } = params;
    const doubtAnswers = await request(api.AppuserApiFetchParamCreactor.appuserGetDoubtAnswersAsync({}));
    this.doubtAnswers = doubtAnswers;
    callback && callback(doubtAnswers);
  }
  async getDoubtAnswer(params) {
    const { formId, callback } = params;
    const doubtAnswer = await request(api.AppuserApiFetchParamCreactor.appuserGetDoubtAnswerAsync({
      formId
    }));
    this.doubtAnswer = doubtAnswer;
    callback && callback(doubtAnswer);
  }
  async getAgencyAmount(params) {
    const { callback } = params;
    const agencyAmount = await request(api.AppuserApiFetchParamCreactor.appuserGetAgencyAmountAsync({}));
    this.agencyAmount = agencyAmount;
    callback && callback(agencyAmount);
  }
  /**
   * 代理升级购买
   */
  async agencyApply(params) {
    const { form, callback } = params;
    const userBuyAgencyLeval = await request(api.AppuserApiFetchParamCreactor.appuserAgencyApplyAsync({
      form
    }));
    this.userBuyAgencyLeval = userBuyAgencyLeval;
    callback && callback(userBuyAgencyLeval);
  }
  async getUserBuyAgencyLeval(params) {
    const { pageIndex, pageSize, callback } = params;
    const userBuyAgencyLeval = await request(api.AppuserApiFetchParamCreactor.appuserGetUserBuyAgencyLevalAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.userBuyAgencyLeval = userBuyAgencyLeval;
    callback && callback(userBuyAgencyLeval);
  }
  async getUserRegistAgreement(params) {
    const { callback } = params;
    const userRegistAgreement = await request(api.AppuserApiFetchParamCreactor.appuserGetUserRegistAgreementAsync({}));
    this.userRegistAgreement = userRegistAgreement;
    callback && callback(userRegistAgreement);
  }
  async getAllUserCrowdFunding(params) {
    const { pageIndex, pageSize, callback } = params;
    const allUserCrowdFunding = await request(api.AppuserApiFetchParamCreactor.appuserGetAllUserCrowdFundingAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.allUserCrowdFunding = allUserCrowdFunding;
    callback && callback(allUserCrowdFunding);
  }
  /**
   * 企业认证
   */
  async saveEnterpriseCertification(params) {
    const { form, callback } = params;
    const userBuyAgencyLeval = await request(api.AppuserApiFetchParamCreactor.appuserSaveEnterpriseCertificationAsync({
      form
    }));
    this.userBuyAgencyLeval = userBuyAgencyLeval;
    callback && callback(userBuyAgencyLeval);
  }
  /**
   * 获取企业认证需不需
   */
  async getUserEnterpriseCertificationInfo(params) {
    const { callback } = params;
    const userEnterpriseCertificationInfo = await request(api.AppuserApiFetchParamCreactor.appuserGetUserEnterpriseCertificationInfoAsync({}));
    callback && callback(userEnterpriseCertificationInfo);
  }
};
export { UserStore as default };

tslib_1.__decorate([observable], UserStore.prototype, "smsCode", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getSmsCode", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "userLogin", null);
tslib_1.__decorate([observable], UserStore.prototype, "registerStepOne", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "registerStepOneF", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "logout", null);
tslib_1.__decorate([observable], UserStore.prototype, "userInfo", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserInfo", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "setPassword", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "updateUserPassword", null);
tslib_1.__decorate([observable], UserStore.prototype, "userCommisions", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserCommisions", null);
tslib_1.__decorate([observable], UserStore.prototype, "userCashes", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserCashes", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "getCashService", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserBenifitsStatistics", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "cash", null);
tslib_1.__decorate([observable], UserStore.prototype, "spreadUsers", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getSpreadUsers", null);
tslib_1.__decorate([observable], UserStore.prototype, "userShareCount", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserShareCount", null);
tslib_1.__decorate([observable], UserStore.prototype, "userShareUsers", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserShareUsers", null);
tslib_1.__decorate([observable], UserStore.prototype, "userFavorites", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserFavorites", null);
tslib_1.__decorate([observable], UserStore.prototype, "userCards", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserCards", null);
tslib_1.__decorate([observable], UserStore.prototype, "banks", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getBanks", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "saveUserCard", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "removeUserCard", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "modifyUser", null);
tslib_1.__decorate([observable], UserStore.prototype, "userAddresses", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserAddresses", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "saveUserAddress", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "removeUserAddress", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "setDefaultUserAddress", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "saveUserCollection", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "cancelUserCollection", null);
tslib_1.__decorate([observable], UserStore.prototype, "userPointRecords", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserPointRecords", null);
tslib_1.__decorate([observable], UserStore.prototype, "myRelease", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getMyRelease", null);
tslib_1.__decorate([observable], UserStore.prototype, "myApplication", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getMyApplication", null);
tslib_1.__decorate([observable], UserStore.prototype, "myCourseInfo", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getMyCourseInfo", null);
tslib_1.__decorate([observable], UserStore.prototype, "doubtAnswers", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getDoubtAnswers", null);
tslib_1.__decorate([observable], UserStore.prototype, "doubtAnswer", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getDoubtAnswer", null);
tslib_1.__decorate([observable], UserStore.prototype, "agencyAmount", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getAgencyAmount", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "agencyApply", null);
tslib_1.__decorate([observable], UserStore.prototype, "userBuyAgencyLeval", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserBuyAgencyLeval", null);
tslib_1.__decorate([observable], UserStore.prototype, "userRegistAgreement", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserRegistAgreement", null);
tslib_1.__decorate([observable], UserStore.prototype, "allUserCrowdFunding", undefined);
tslib_1.__decorate([loading, action], UserStore.prototype, "getAllUserCrowdFunding", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "saveEnterpriseCertification", null);
tslib_1.__decorate([loading, action], UserStore.prototype, "getUserEnterpriseCertificationInfo", null);